#ifndef __RD0FF_BSP_EXTI_CONFIG_H
#define __RD0FF_BSP_EXTI_CONFIG_H

/**
 * @brief EXTI线枚举定义
 * 
 * 定义STM32F1支持的所有外部中断线，用于中断线的选择和配置
 */
typedef enum {
    BSP_EXTI_LINE_0  = 0x00000001U,  /* EXTI线0  - PA0/PB0/PC0/PD0/PE0/PF0/PG0 */
    BSP_EXTI_LINE_1  = 0x00000002U,  /* EXTI线1  - PA1/PB1/PC1/PD1/PE1/PF1/PG1 */
    BSP_EXTI_LINE_2  = 0x00000004U,  /* EXTI线2  - PA2/PB2/PC2/PD2/PE2/PF2/PG2 */
    BSP_EXTI_LINE_3  = 0x00000008U,  /* EXTI线3  - PA3/PB3/PC3/PD3/PE3/PF3/PG3 */
    BSP_EXTI_LINE_4  = 0x00000010U,  /* EXTI线4  - PA4/PB4/PC4/PD4/PE4/PF4/PG4 */
    BSP_EXTI_LINE_5  = 0x00000020U,  /* EXTI线5  - PA5/PB5/PC5/PD5/PE5/PF5/PG5 */
    BSP_EXTI_LINE_6  = 0x00000040U,  /* EXTI线6  - PA6/PB6/PC6/PD6/PE6/PF6/PG6 */
    BSP_EXTI_LINE_7  = 0x00000080U,  /* EXTI线7  - PA7/PB7/PC7/PD7/PE7/PF7/PG7 */
    BSP_EXTI_LINE_8  = 0x00000100U,  /* EXTI线8  - PA8/PB8/PC8/PD8/PE8/PF8/PG8 */
    BSP_EXTI_LINE_9  = 0x00000200U,  /* EXTI线9  - PA9/PB9/PC9/PD9/PE9/PF9/PG9 */
    BSP_EXTI_LINE_10 = 0x00000400U,  /* EXTI线10 - PA10/PB10/PC10/PD10/PE10/PF10/PG10 */
    BSP_EXTI_LINE_11 = 0x00000800U,  /* EXTI线11 - PA11/PB11/PC11/PD11/PE11/PF11/PG11 */
    BSP_EXTI_LINE_12 = 0x00001000U,  /* EXTI线12 - PA12/PB12/PC12/PD12/PE12/PF12/PG12 */
    BSP_EXTI_LINE_13 = 0x00002000U,  /* EXTI线13 - PA13/PB13/PC13/PD13/PE13/PF13/PG13 */
    BSP_EXTI_LINE_14 = 0x00004000U,  /* EXTI线14 - PA14/PB14/PC14/PD14/PE14/PF14/PG14 */
    BSP_EXTI_LINE_15 = 0x00008000U   /* EXTI线15 - PA15/PB15/PC15/PD15/PE15/PF15/PG15 */
} bsp_exti_line_t;

/**
 * @brief EXTI触发模式枚举
 * 
 * 定义外部中断的触发方式，支持上升沿、下降沿和双边沿触发
 */
typedef enum {
    BSP_EXTI_TRIGGER_RISING  = 0x00000000U,  /* 上升沿触发 */
    BSP_EXTI_TRIGGER_FALLING = 0x00000001U,  /* 下降沿触发 */
    BSP_EXTI_TRIGGER_BOTH    = 0x00000002U   /* 双边沿触发 */
} bsp_exti_trigger_t;

/**
 * @brief GPIO端口枚举
 * 
 * 定义STM32F1支持的GPIO端口，用于EXTI线的GPIO配置
 */
typedef enum {
    BSP_GPIO_PORT_A = 0x00000000U,  /* GPIOA端口 */
    BSP_GPIO_PORT_B = 0x00000001U,  /* GPIOB端口 */
    BSP_GPIO_PORT_C = 0x00000002U,  /* GPIOC端口 */
    BSP_GPIO_PORT_D = 0x00000003U,  /* GPIOD端口 */
    BSP_GPIO_PORT_E = 0x00000004U,  /* GPIOE端口 */
    BSP_GPIO_PORT_F = 0x00000005U,  /* GPIOF端口 */
    BSP_GPIO_PORT_G = 0x00000006U   /* GPIOG端口 */
} bsp_gpio_port_t;

/**
 * @brief EXTI中断优先级枚举
 * 
 * 定义中断优先级级别，数值越小优先级越高
 */
typedef enum {
    BSP_EXTI_PRIORITY_HIGHEST = 0x00,  /* 最高优先级 */
    BSP_EXTI_PRIORITY_HIGH    = 0x01,  /* 高优先级   */
    BSP_EXTI_PRIORITY_MEDIUM  = 0x02,  /* 中等优先级 */
    BSP_EXTI_PRIORITY_LOW     = 0x03,  /* 低优先级   */
    BSP_EXTI_PRIORITY_LOWEST  = 0x04   /* 最低优先级 */
} bsp_exti_priority_t;

/**
 * @brief EXTI事件类型枚举
 * 
 * 定义中断事件的类型，用于事件队列中的事件分类
 */
typedef enum {
    BSP_EXTI_EVENT_RISING  = 0x00,  /* 上升沿事件 */
    BSP_EXTI_EVENT_FALLING = 0x01,  /* 下降沿事件 */
    BSP_EXTI_EVENT_TIMEOUT = 0x02,  /* 超时事件   */
    BSP_EXTI_EVENT_ERROR   = 0x03   /* 错误事件   */
} bsp_exti_event_type_t;

#endif // END __RD0FF_BSP_EXTI_CONFIG_H